{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 一、目的：\n",
    "### 1.用tensorflow实现一个简单的卷积神经网络模型；\n",
    "### 2.用Mnist手写数字训练这个模型，并且可以识别测试图片。\n",
    "https://github.com/Hvass-Labs/TensorFlow-Tutorials/blob/master/02_Convolutional_Neural_Network.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 二、声明\n",
    "### 最好了解简单的线性代数运算、python编程知识、以及卷积神经网络基本知识，可参考[ 这篇博客](http://www.enpeizhao.com/?p=332)："
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 三、流程"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.导入工具包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "#encoding:UTF-8\n",
    "import matplotlib.pyplot as plt\n",
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "from sklearn.metrics import confusion_matrix\n",
    "import time\n",
    "from datetime import timedelta\n",
    "import math\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting MNIST-data/train-images-idx3-ubyte.gz\n",
      "Extracting MNIST-data/train-labels-idx1-ubyte.gz\n",
      "Extracting MNIST-data/t10k-images-idx3-ubyte.gz\n",
      "Extracting MNIST-data/t10k-labels-idx1-ubyte.gz\n"
     ]
    }
   ],
   "source": [
    "from tensorflow.examples.tutorials.mnist import input_data\n",
    "data = input_data.read_data_sets('MNIST-data/', one_hot=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3.查看数据基本信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "训练数据共：55000\n",
      "测试数据共：10000\n",
      "第一个测试图的维度：(784,)\n",
      "第一个测试图的真实值：[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]\n"
     ]
    }
   ],
   "source": [
    "print \"训练数据共：\"+str(len(data.train.images))\n",
    "print \"测试数据共：\"+str(len(data.test.images))\n",
    "print \"第一个测试图的维度：\"+str(data.test.images[0].shape)\n",
    "print \"第一个测试图的真实值：\"+str(data.test.labels[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4.检测数据与标签是否对应"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def plot_images(images, cls_true, cls_pred=None):\n",
    "    assert len(images) == len(cls_true) == 9\n",
    "    \n",
    "    # Create figure with 3x3 sub-plots.\n",
    "    fig, axes = plt.subplots(3, 3)\n",
    "    fig.subplots_adjust(hspace=0.3, wspace=0.3)\n",
    "\n",
    "    for i, ax in enumerate(axes.flat):\n",
    "        # Plot image.\n",
    "        ax.imshow(images[i].reshape((28,28)), cmap='binary')\n",
    "\n",
    "        # Show true and predicted classes.\n",
    "        if cls_pred is None:\n",
    "            xlabel = \"label: {0}\".format(cls_true[i])\n",
    "        else:\n",
    "            xlabel = \"True: {0}, Pred: {1}\".format(cls_true[i], cls_pred[i])\n",
    "\n",
    "        ax.set_xlabel(xlabel)\n",
    "        \n",
    "        # Remove ticks from the plot.\n",
    "        ax.set_xticks([])\n",
    "        ax.set_yticks([])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUMAAAD5CAYAAAC9FVegAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHq5JREFUeJzt3XmUFNXd//H3F8QgoiyBKC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Y2U4zW1H0L6OLY+dsp2szqw6MAF6LOi2SEUOAFc65HmZ2LDAGOLuM10jV\nM8851zWMG4XymGxmtc1stpktM7NVZtY97vABZjbBzNaZ2SQzq1X0mrZmNtfM3jGzWWbWKMXbDgJe\nAral631I6SLI41bAHADn3Hogz8wOS987kuIi+h6HJqw6wx+AHs65k4AzgQcsWPKuBfCoc64l8BUw\n0MxqAKOBXs65tsA44J7iFzWzO82sW5L9jYEewGMZeTeSTKh5DKwEehad879AM+DINL8nSRR2HgO0\nM7OVZjbDzI5L9xuKF9ZjsgHDzaw9sA9oDPi/4h875/5dtD0euAaYCbQGXi/6rKsDnxa/qHOutDqE\nUcDNzrl98cuMSkaFncf3Av/PzFYAq4DlwN70vBUpRdh5vIzCPoLfmFkXYCpwdJreSwlhFYZ9gIZA\nW+fcbjPbDNQsOla8o6Oj8ENf45xrV8H75QMTizKgAdDFzPY456ZW8HpStlDz2Dn3FXAZQFF0sgn4\nsCLXknKLIo/99qtm9qiZNXDOFVTkemUJ6zG5DrCt6AM8k8JHGq+pmfkP61JgPrABaOj3m1mNVEJk\n59z/OOfynHN5wCRgoArCjAs1j82srpn5tR7+CLwd/+WRjAg7jw/3j+FFVSHVgO1peB9JhVUYTgDy\nzWwV0A9YH3dsA3C1ma0D6gGPOed+BHoBI8xsJbACOLX4Rcuoa5BwhZ3HLYHVZrYB6Axcm9Z3I8mE\nnce9KMzjlcDDQG+XwSFzGo4nIoJGoIiIACoMRUQAFYYiIoAKQxERQIWhiAigwlBEBFBhKCICqDAU\nEQHg/wDFEXwpmLudbQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x113510b90>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Get the first images from the test-set.\n",
    "images = data.test.images[0:9]\n",
    "\n",
    "# Get the true classes for those images.\n",
    "cls_true = np.argmax(data.test.labels[0:9],1)\n",
    "\n",
    "# Plot the images and labels using our helper-function above.\n",
    "plot_images(images=images, cls_true=cls_true)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# use x to get the input data [None,784]\n",
    "x = tf.placeholder(dtype=tf.float32,shape=[None,784])\n",
    "# reshape x to NHWC format\n",
    "x_reshape = tf.reshape(tensor=x,shape=[-1,28,28,1])\n",
    "\n",
    "# convolutional layer1 #1 \n",
    "\n",
    "\n",
    "#input NHWC(Num of samples ,Heights,weights,Channels)\n",
    "filter1 = tf.Variable(tf.truncated_normal(stddev=0.05,shape=[5,5,1,32]))\n",
    "conv1 = tf.nn.conv2d(\n",
    "    input = x_reshape,\n",
    "    filter = filter1,\n",
    "    strides = [1,1,1,1],\n",
    "    padding = \"SAME\"\n",
    "    \n",
    ")\n",
    "\n",
    "# biases1\n",
    "biases1 = tf.Variable(tf.constant(value=0.05,shape=[32]))\n",
    "# conv1 + biases1\n",
    "conv1+=biases1\n",
    "# relu\n",
    "conv1 = tf.nn.relu(conv1)\n",
    "\n",
    "# max pooling layer #1\n",
    "pool1 = tf.nn.max_pool(\n",
    "    value = conv1,\n",
    "    ksize = [1,2,2,1],\n",
    "    strides = [1,2,2,1],\n",
    "    padding = \"SAME\"\n",
    ")\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "# convolutional layer # 2\n",
    "filter2 = tf.Variable(tf.truncated_normal(stddev=0.05,shape = [5,5,32,64]))\n",
    "conv2 = tf.nn.conv2d(\n",
    "    input = pool1,\n",
    "    filter = filter2,\n",
    "    strides = [1,1,1,1],\n",
    "    padding = \"SAME\"\n",
    ")\n",
    "\n",
    "# biases 2\n",
    "biases2 = tf.Variable(tf.constant(value=0.05,shape=[64]))\n",
    "conv2 +=biases2\n",
    "\n",
    "# relu\n",
    "conv2 = tf.nn.relu(conv2)\n",
    "\n",
    "\n",
    "#max pooling layer #2\n",
    "pool2 = tf.nn.max_pool(\n",
    "    value = conv2,\n",
    "    ksize = [1,2,2,1],\n",
    "    strides = [1,2,2,1],\n",
    "    padding=\"SAME\"\n",
    ")\n",
    "\n",
    "\n",
    "\n",
    "# flat the  [-1,7,7,64] matrix to [-1,7*7*64] matrix\n",
    "flat = tf.reshape(tensor=pool2,shape=[-1,7*7*64])\n",
    "\n",
    "\n",
    "fc_weigth1 = tf.Variable(tf.truncated_normal(stddev=0.05,shape=[7*7*64,128]))\n",
    "fc_biases1 = tf.Variable(tf.constant(value=0.05,shape=[128]))\n",
    "\n",
    "# fully connected layer #1\n",
    "fc1 = tf.matmul(flat,fc_weigth1) + fc_biases1\n",
    "\n",
    "\n",
    "# fully connected layer #2\n",
    "fc_weights2 = tf.Variable(tf.truncated_normal(stddev =0.05,shape=[128,10]))\n",
    "fc_biases2 = tf.Variable(tf.constant(value =0.05,shape=[10]))\n",
    "fc2 = tf.matmul(fc1,fc_weights2)+fc_biases2\n",
    "\n",
    "# logits is one-hot encoded\n",
    "logits = tf.nn.softmax(fc2)\n",
    "# the max value index is the predict class\n",
    "y_pred_cls = tf.arg_max(logits,1)\n",
    "\n",
    "# use y_true to input the labels(one hot encoded) of input data \n",
    "y_true = tf.placeholder(dtype=tf.float32,shape=[None,10])\n",
    "# real class of input data\n",
    "y_true_cls = tf.arg_max(y_true,1)\n",
    "\n",
    "# cross entropy \n",
    "cross_entropy  = tf.nn.softmax_cross_entropy_with_logits(logits=logits,labels=y_true)\n",
    "# cost function\n",
    "cost = tf.reduce_mean(cross_entropy)\n",
    "\n",
    "# optimizer \n",
    "optimizer = tf.train.AdamOptimizer(learning_rate=0.001).minimize(cost)\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# initial tensor session\n",
    "session = tf.Session()\n",
    "session.run(tf.global_variables_initializer())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def accuracy_print(type=\"test\",input_x=None,input_y=None):\n",
    "    \n",
    "    if type == \"test\":\n",
    "        dict= {\n",
    "            x:data.test.images,\n",
    "            y_true:data.test.labels\n",
    "        }\n",
    "    elif type ==\"train\":\n",
    "        dict= {\n",
    "            x:input_x,\n",
    "            y_true:input_y\n",
    "        }\n",
    "        \n",
    "    equals = tf.equal(y_pred_cls,y_true_cls)\n",
    "    formula = tf.reduce_mean(tf.cast(equals,dtype=tf.float32))\n",
    "    accuracy = session.run(formula,feed_dict=dict)\n",
    "    print type + \" accuracy:{:0.1%}\".format(accuracy)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "batch_size = 60\n",
    "iteration_num =0\n",
    "def optimize(num):\n",
    "    global iteration_num\n",
    "    for i in range(num):\n",
    "        x_batch,y_batch = data.train.next_batch(batch_size)\n",
    "        dic= {\n",
    "            x : x_batch,\n",
    "            y_true : y_batch\n",
    "            \n",
    "        }\n",
    "        summary = session.run(optimizer,feed_dict=dic)\n",
    "        iteration_num+=1\n",
    "        \n",
    "        if iteration_num %100 == 0:\n",
    "            print 'iteration num ' + str(iteration_num)\n",
    "            accuracy_print(\"train\",x_batch,y_batch)\n",
    "            print '\\n'\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def plot_example_errors():\n",
    "\n",
    "    data.test.cls = np.array([label.argmax() for label in data.test.labels])\n",
    "    whether_equals = tf.equal(y_pred_cls,y_true_cls)\n",
    "    # Use TensorFlow to get a list of boolean values\n",
    "    # whether each test-image has been correctly classified,\n",
    "    # and a list for the predicted class of each image.\n",
    "    feed_dict_test = {\n",
    "                  x: data.test.images,\n",
    "                  y_true: data.test.labels,\n",
    "                  y_true_cls: data.test.cls\n",
    "    }\n",
    "    correct, cls_pred = session.run([whether_equals, y_pred_cls],\n",
    "                                    feed_dict=feed_dict_test)\n",
    "\n",
    "    # Negate the boolean array.\n",
    "    incorrect = (correct == False)\n",
    "    \n",
    "    # Get the images from the test-set that have been\n",
    "    # incorrectly classified.\n",
    "    images = data.test.images[incorrect]\n",
    "    \n",
    "    # Get the predicted classes for those images.\n",
    "    cls_pred = cls_pred[incorrect]\n",
    "\n",
    "    # Get the true classes for those images.\n",
    "    cls_true = data.test.cls[incorrect]\n",
    "    \n",
    "    # Plot the first 9 images.\n",
    "    plot_images(images=images[0:9],\n",
    "                cls_true=cls_true[0:9],\n",
    "                cls_pred=cls_pred[0:9])\n",
    "    \n",
    "    \n",
    "def print_confusion_matrix():\n",
    "    num_classes=10\n",
    "    # Get the true classifications for the test-set.\n",
    "    data.test.cls = np.array([label.argmax() for label in data.test.labels])\n",
    "    cls_true = data.test.cls\n",
    "    feed_dict_test = {x: data.test.images,\n",
    "                  y_true: data.test.labels,\n",
    "                  y_true_cls: data.test.cls}\n",
    "    \n",
    "    # Get the predicted classifications for the test-set.\n",
    "    cls_pred = session.run(y_pred_cls, feed_dict=feed_dict_test)\n",
    "\n",
    "    # Get the confusion matrix using sklearn.\n",
    "    cm = confusion_matrix(y_true=cls_true,\n",
    "                          y_pred=cls_pred)\n",
    "\n",
    "    # Print the confusion matrix as text.\n",
    "    print(cm)\n",
    "\n",
    "    # Plot the confusion matrix as an image.\n",
    "    plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n",
    "\n",
    "    # Make various adjustments to the plot.\n",
    "    plt.tight_layout()\n",
    "    plt.colorbar()\n",
    "    tick_marks = np.arange(num_classes)\n",
    "    plt.xticks(tick_marks, range(num_classes))\n",
    "    plt.yticks(tick_marks, range(num_classes))\n",
    "    plt.xlabel('Predicted')\n",
    "    plt.ylabel('True')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "test accuracy:11.6%\n"
     ]
    }
   ],
   "source": [
    "accuracy_print(\"test\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "test accuracy:10.2%\n"
     ]
    }
   ],
   "source": [
    "optimize(1)\n",
    "accuracy_print(\"test\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "iteration num 100\n",
      "train accuracy:71.7%\n",
      "\n",
      "\n",
      "test accuracy:74.4%\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD5CAYAAACj3GcTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xe4VNXZ9/HvrVgQFQVEEYVjFBRsRBHEoPhasDyaoPgo\nCmoSsffE2FsiakSxxd5AATViQROfgGJHiQqKSksUC0FFwVgoioX1/jH7nj2nzuxzppwZfp/rOhd7\nZrd1WGfW3KvstSyEgIiI5GaVUidARKScqNAUEUlAhaaISAIqNEVEElChKSKSgApNEZEEVGiKiCSg\nQlNEJAEVmiIiCbRoysnt2rULVVVVeUpKeZg2bdqiEMIGpU5HsSiPK5/yOJkmFZpVVVVMnTq1KZco\nO2b2UanTUEzK48qnPE5G1XMRkQRUaIqIJKBCU0QkARWaIiIJqNAUEUmgSb3nhXLNNdcA8O233wLw\n9ttvA/Dwww/XOvbEE08EoE+fPgAceeSRxUiiiKykFGmKiCTQrCLNww47DIBx48bVud/Mar132223\nATBp0iQA+vXrB0CnTp0KkUQRAZYsWQLAf/7zHwBuvfXWWsf89re/BaBHjx7FS1gRKNIUEUmg5JGm\nR5dQf4S51VZbAbDvvvsC8P7776f3PfHEEwC89957AIwZMwaA888/P/+JFVnJeYR59dVXA3DZZZfV\ne6zXAv0zfsMNNwDQpk2bQiax4BRpiogkULJI0591feyxx2rt22abbYA4imzXrh0Aa6+9NgDff/99\n+tjevXsD8NZbbwHwxRdfFCjFUgjffPMNAOeeey4AM2fOBOI2aoDVVlut+AmTOl1xxRUA/PnPf856\n7I8//gjA2LFjAXjmmWcAGDVqFAD9+/cvQAoLT5GmiEgCJYs0P/30UwBCCOn3PMKcOHEiAB06dKjz\nXB/HCTB79uxq+w444IC8plMKw9ueL7zwQgDmzZtXbb9HoABt27YtXsKkQZtttlm11z6i5ZRTTkm/\nt/XWWwNxjfDiiy8GYMGCBQD86le/AuCcc85Jn3P22WcDsNZaaxUi2XmlSFNEJIGSRZoHHnggEPd6\nA6yzzjpA9t61v/71r+ntzPZNaf7mz58PwJlnngnAokWLgNpjcE899dT09k033QSUf69rJajZB3Ho\noYcCcc94XbbffnsADj74YCDud/jTn/6UPmbu3LkA3HPPPUDzbsdWpCkikoAKTRGRBEo+uL1z5845\nH+sDav/973/X2udDj/xfaZ68Ey/b0LAHH3wwvf2Pf/wDiDuNvOq++uqrFyKJ0gDPC29OueCCC7Ke\ns+uuuwLw+OOPA3DeeecB8NJLL6WP8WFJ3jHsw5JatCh5EVWLIk0RkQSaXzFeh7///e9APHRh+fLl\n6X0bbrghEA+2LYchCyubjz6K17AaOXJktX3eSeD5+PTTT9c6/+uvvwbiKHXw4MEAbLTRRvlPrDRo\nr732AuKB6v7ASS522WUXAIYPHw7A/vvvn9735ZdfAnD//fcD8Mtf/hKIO5qaE0WaIiIJlEWk6Y9c\nZkaYzicD8CnhpPmZPn16etsHre+2224AvPDCCwB89913QBxpXHnllelzfFhazcHR3r6moUjF061b\nNyCONOty1113AXFeHn/88XUed8QRR6S3b7755mr76uq3aC4UaYqIJNCsI80BAwYA8WOV7uijj05v\nDxs2rKhpkuQyawje6+qD292aa64JxBPXZi5t4gOfvWfV263Ve158PXv2rPbal6LxmgLEj1T6gyfP\nP/984vvcfffdQDwt5N57753e17p168TXyydFmiIiCTTLSNMn83jllVeAOFLZYIMNgHi8HiTrvZPS\neOCBB2q99+STTwJxbaImb8euy8477wwo70vB8+u+++4DYI899gDgs88+Sx/jtYamPOLsIy689zxz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TzazeakAOJgIneTXEzLY0s5bAi8BhUZtIR6BfDtd6Ajgquk5f4LMQQiVV26pRHiuPqcw8\nHg/samarmlkroBep9td65XOc5jmkfplXSJXe7mTgF1GD7SzgWAAz621mt9VxnX7A4cDeFg+L2Cfa\n1w34oglpvB14F5huZjOAW0lF2w8D80i1gYwEpvgJZna5me1fx7X+BnxsZnOj65xcxzGVRnlc+Vaq\nPA4hzACeBd4h1cxwSwhhdkM3L6vHKM3sSeBXIYQfS50WKQzlceUr9zwuq0JTRKTU9BiliEgCKjRF\nRBJQoSkikoAKTRGRBFRoiogkoEJTRCQBFZoiIgn8f6AeoejIcRJWAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x113adcc90>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "optimize(99)\n",
    "accuracy_print(\"test\")\n",
    "plot_example_errors()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "iteration num 200\n",
      "train accuracy:93.3%\n",
      "\n",
      "\n",
      "iteration num 300\n",
      "train accuracy:95.0%\n",
      "\n",
      "\n",
      "iteration num 400\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 500\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 600\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 700\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 800\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 900\n",
      "train accuracy:93.3%\n",
      "\n",
      "\n",
      "iteration num 1000\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 1100\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 1200\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 1300\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 1400\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 1500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 1600\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 1700\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 1800\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 1900\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 2000\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 2100\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 2200\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 2300\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 2400\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 2500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 2600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 2700\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 2800\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 2900\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 3000\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 3100\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 3200\n",
      "train accuracy:95.0%\n",
      "\n",
      "\n",
      "iteration num 3300\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 3400\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 3500\n",
      "train accuracy:95.0%\n",
      "\n",
      "\n",
      "iteration num 3600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 3700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 3800\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 3900\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4000\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4100\n",
      "train accuracy:95.0%\n",
      "\n",
      "\n",
      "iteration num 4200\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4300\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4400\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 4500\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 4600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 4800\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 4900\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 5000\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 5100\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 5200\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 5300\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 5400\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 5500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 5600\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 5700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 5800\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 5900\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6000\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6100\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6200\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6300\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6400\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6800\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 6900\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 7000\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 7100\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 7200\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7300\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7400\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7800\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 7900\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8000\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 8100\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 8200\n",
      "train accuracy:96.7%\n",
      "\n",
      "\n",
      "iteration num 8300\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8400\n",
      "train accuracy:95.0%\n",
      "\n",
      "\n",
      "iteration num 8500\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8600\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8700\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8800\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "iteration num 8900\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 9000\n",
      "train accuracy:98.3%\n",
      "\n",
      "\n",
      "iteration num 9100\n",
      "train accuracy:100.0%\n",
      "\n",
      "\n",
      "test accuracy:98.7%\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD5CAYAAACj3GcTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XecVNX9//HXx6CCYAyKCiqwMSCCGBvB+lMTFTUWEBtf\nNYo1KiL2HsVYotgIFhQLRbGBDSuKookFBQSRYi8Ug0EDdmx8fn/MPTN3YMvcnbrr+/l48NiZO7ec\n5cw9+znnnmLujoiI5GalcidARKQhUaEpIpKACk0RkQRUaIqIJKBCU0QkARWaIiIJqNAUEUlAhaaI\nSAIqNEVEEmiSz8GtWrXyqqqqAiWlYZg6depn7r52udNRKsrjxk95nExehWZVVRVTpkzJ5xQNjpl9\nXO40lJLyuPFTHiej6rmISAIqNEVEElChKSKSgApNEZEEVGiKiCSgQlNEJAEVmiIiCeTVT7OSjRs3\nDoAbb7wxve3+++8HYI011ihLmqR+br75ZgBOOOEEAB544AEAevfuXbY0SWn99NNP6dehT+m0adOy\n3r/99tsAdOrUCYCTTjopfcwWW2xRsLQo0hQRSaDRRZqTJk0CoG/fvgDsvffe6c9WXXXVciRJ6uGm\nm25Kv45HDACrr756qZMjJfbjjz8CMHnyZACuvvrq9GcPPfRQrce+9NJLALz++uvpbSEqLQRFmiIi\nCTSaSPPJJ58EMu1fixcvBqB169bpfZo2bVr6hEkiL7/8MgADBgxIbws1hLvuuguA3XbbrfQJk5II\n7ZIh/8ePH1/nMa1atQJg0003zdp+ww03FDh1KYo0RUQSaPCR5nfffQfAbbfdBmSemq+yyioAbLnl\nluVJmCQye/ZsAPr06bPCZ4MGDQJg//33L2mapLjiT8T/9re/AZneLl999VXWvvEeL6EXxf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b+A3YG6Cs2r3H1wHek0oJe7vx/fIdcbYrm0xatrw0hF\nqI1N0fM4oVLfx92AMdH3oxXQw8x+dvdHazqgIF2OopJ9sZl1NLOVgHjiJwD9wptaqkHhXPOBT6Pw\nHGAXYHZ07AAzOz6PpI4HTrRUwy9m1snMmgH/Ag6O2kTWB3bK4VzjgMOj8+wAfOru9V+ftsIVMo/N\nbB0zWyN6vRqpKOat6P2g0A5ZT+NJ1VLCtUI1/F/AIdG2zYBN6jqRmbWJve1Fqt2v0SpkHtemku5j\nd2/n7lXuXkWqZnFcbQUmFLaf5tmkfpmXSUWLQT9g+6hdaDZwLNTZFtIfuM/MZpD6cl8Rbe8MfJ5H\nGm8B3gWmm9lMYCipaHssMJdU4TwceCUcUEub5qPAAjN7PzpPv2r2aWwKlcfrAS+Y2RvAa8Dj7v5U\n9NnvgYV5pPFioLmluiXNAgZG228A1jKzOcDfgGnhgFraNE8zs5lROo8Hjs4jXQ1Fwe5jMxsD/Bvo\nYmbzo6YVqKz7OLEGNYzSzB4HehahW4lUAEvVkZ509z3KnRYpnoZ+HzeoQlNEpNw0jFJEJAEVmiIi\nCajQFBFJQIWmiEgCKjRFRBJQoSkikoAKTRGRBP4/KtGs5Bgbbq4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11d4a3050>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "optimize(9000)\n",
    "accuracy_print(\"test\")\n",
    "plot_example_errors()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 978    0    0    0    0    0    0    1    1    0]\n",
      " [   1 1105   11    1    1    1    1    2   12    0]\n",
      " [   4    0 1025    0    0    0    0    2    1    0]\n",
      " [   0    0    1 1006    0    3    0    0    0    0]\n",
      " [   0    0    2    0  962    0    0    2    1   15]\n",
      " [   0    0    1    6    0  884    1    0    0    0]\n",
      " [  11    0    3    0    5    5  929    0    5    0]\n",
      " [   0    2    3    1    0    0    0 1019    1    2]\n",
      " [   2    0    5    2    0    1    0    0  961    3]\n",
      " [   1    0    0    2    3    2    0    1    0 1000]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWAAAAEmCAYAAABcYEo9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHJlJREFUeJzt3X+QH3Wd5/HnKwk/EmBJzMQUJsHkhMOlqJPgXIyyckqU\nBWSBvXNdqBMil72cHrIg7insXRV3e1e1euv5A3ePuizBDS4gGKBIKcsPEWWxJEsIEQJBCT+TbCAJ\nhB+CCIH3/dGfkWGcZPo705/pb/f39bC6pru/PZ93txne85lPf34oIjAzs/E3oe4bMDPrVU7AZmY1\ncQI2M6uJE7CZWU2cgM3MauIEbGZWEydgM7OaOAGbmdXECdjMrCaT6r6BwbT3/qEp07PGmP+uGVnL\nN7M3PfHE4+zYsUNVljnxd94ZsetXpa+PX22/OSKOr/IeqtJdCXjKdPb5NxdmjfGTaz+dtXwze9PR\n7+uvvMzY9Qr7vPu00te/cu83+yq/iYp0VQI2MxuRAFVaqa6NE7CZNY/a8frKCdjMmsc1YDOzOsg1\nYDOz2rgGbGZWA+EasJlZPdSaGnDWXyOSjpf0c0kbJV2QM5aZ9RBNKL91sWx3J2ki8DfACcDhwOmS\nDs8Vz8x6iFR+62I5fz0sADZGxKMR8SrwHeCUjPHMrCfINeASZgGbBh1vTufeQtJSSWskrYlXf5nx\ndsysFQZGwrWgBlz7S7iIWAYsA5gw9Z1R8+2YWRN0ec22rJwJeAswZ9Dx7HTOzGwM2jMQI+dT3A0c\nKmmepL2B04BVGeOZWa+YoPJbF8tWA46IXZI+C9wMTAQui4gHcsUzsx7hgRjlRMSNwI05Y5hZD+ry\nl2tl1f4SzsysM+1pA3YCNrPmaUkNuB2/Rsyst1Q4EEPSZZK2SVo/6NzbJN0q6eH0dVo6L0kX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k/RTSWtTTXl/+M28zQ9JWsugmbMkfUrSX6f9mZKuT/MW\n/0zSB4AvAe9Kte+/Stf9F0l3S7pv8NzGkv6rpF9IuhM4DLMGadxIOBt/aYrDEygmYQE4FFgcEXdJ\n6gP+G/CRiHhJ0heB8yX9b+BvgWOBjcDVuyn+YuDHEfGHadTe/hST4RyRJhJC0nEp5gKKeY5XpUl5\nXqIYAn0kxc/yWiDnxEBmlXICtj2ZPGiY9D9SzF3xDuCJiLgrnV8IHA78JA0Z3hv4KfBuigliHgZI\nk/QMN53kscCZUMzeBjyfZvca7Li03ZuO96dIyAcA10fEyylG4+YEsd7mBGx78quBWuiAlGRfGnyK\nYq7h04dc95bvGyMBfxkR/29IDC+LY43mNmAbq7uAoyUdAr+ZwexfUsy8NlfSu9J1p+/m+28DPpO+\nd2JaoeJFitrtgJuB/zCobXlWmpnrDuBUSZPTrGl/UPGzmWXlBGxjEhHbgU8BV0m6j9T8EBGvUDQ5\nfD+9hNu2myLOBT4s6X6K9tvDI+IZiiaN9ZL+Kq3ucCXw03TdSuCAtKTT1RTrAv4DxVSlZo3h2dDM\nzGriGrCZWU2cgM3MauIEbGZWEydgM7OaOAGbmdXECdjMrCZOwGZmNfn/bQ7lPWtZYMYAAAAASUVO\nRK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x113f99190>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "print_confusion_matrix()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
